package com.runner;

import com.example.runner.R;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.Menu;
import android.view.View;

public class Main extends Activity implements View.OnClickListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        findViewById(R.id.rdados_button).OnClickListener(this);
        findViewById(R.id.vdados_button).OnClickListener(this);
        findViewById(R.id.rexercicio_button).OnClickListener(this);
        findViewById(R.id.vmedias_button).OnClickListener(this);
        findViewById(R.id.sobre_button).OnClickListener(this);
        findViewById(R.id.saida_button).OnClickListener(this);
    }
    public void onClick(View v){
    	switch (v.getId()) {
		case R.id.rdados_button:
			startActivities(new Intent(this, RegistrarDadosActivity.class));
			break;
		case R.id.vdados_button:
			startActivities(new Intent(this, RegistrarDadosActivity.class));
			break;
		case R.id.rexercicio_button:
			startActivities(new Intent(this, RegistrarDadosActivity.class));
			break;
		case R.id.vmedias_button:
			startActivities(new Intent(this, RegistrarDadosActivity.class));
			break;
		case R.id.sobre_button:
			new AlertDialog.Builder(this)
			.setTitle(R.string.sobre_tit)
			.setMessage(R.string.sobre_txt)
			.show();
			break;
		case R.id.saida_button:
			acaoSair();
			break;
	
		}
    }
    private void acaoSair(){
    	new AlertDialog.Builder(this)
    	.setMessage(R.string.qstSair)
    	.setCancelable(false)
    	.setPositiveButton(R.string.sim, new DialogInterface.OnClickListener() {
    		public void onClick(DialogInterface dialog, int id){
    			MainActivity.this.finish();
    		}})
    		.setNegativeButton(R.string.nao, new DialogInterface.OnClickListener() {
    			public void onCLick(DialogInterface dialog, int id){
    				dialog.cancel();
    			}})
    			.show();
				
    }
    
}
